<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>v-once指令</title>
  </head>
  <body>
    <div id="root">
      <!-- v-once指令
                1.v-once所在节点在初次动态渲染后，就看作静态内容
                2.以后的数据改变不会引起v-once所在结构的更新，可以优化性能 -->
      <h2 v-once>我可不会自加哦{{num}}</h2>
      <h2>{{num}}</h2>
      <button @click="num++">点我n+1</button>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"></script>
    <script>
      new Vue({
        el: "#root",
        data: {
          num: 1,
        },
      });
    </script>
  </body>
</html>
